package Hosp;
import DB.dao.OperationDao;
import DB.dao.PersonDao;
import DB.dto.DoctorDto;
import DB.dto.OperationDto;
import DB.dto.PersonDto;
import DB.exceptions.*;
import DB.jdbc.OperationDaoImpl;
import DB.jdbc.PersonDaoImpl;
import personal.*;
import Process.Operation;

import java.lang.reflect.InvocationTargetException;
import java.util.*;

import org.simpleframework.xml.Root;

/**
 * User: Vanil
 * Date: 17.11.2010
 * Time: 12:50:56
 */
@Root
public class Hospital {
    public Collection<Department> departments ;
    public Hospital() {
        this.departments = new ArrayList<Department>();
    }
     public void setDepartments(Collection<Department> departments) {
        this.departments = departments;
    }

    public Collection<Department> getDepartments() {

        return departments;
    }

    public static void main(String[] args) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
    //DoctorDto dto = new DoctorDto();
        PersonDao dao = new PersonDaoImpl();
        Department department;
        Collection<Patient> patientCollection;
        try {
            PersonDto doctorDto = dao.findWhereLoginEquals("JackLog")[0];;
            Doctor doctorA = new Doctor((DoctorDto)doctorDto);

            PersonDto doctorDtoB = dao.findByPrimaryKey(2);;
            Doctor doctorB = new Doctor((DoctorDto)doctorDtoB);

            Collection<Patient> patientCollectionA = doctorA.getPatients();
            Collection<Patient> patientCollectionB = doctorB.getPatients();
            OperationDao operDao = new OperationDaoImpl();
            OperationDto dto = operDao.findByPrimaryKey(1);
            Operation operation = new Operation(dto);
            department = doctorA.getDepartment();
            System.out.println(department);
        } catch (DoctorDaoException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
      
        } catch (PersonDaoException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (DepartmentDaoException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (PatientDaoException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (OperationDaoException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        


    }

}
